#include "resource.h"
#include "SplitterWnd.h"
#include "logolib/logo_lib.h"
#include "LogoDisplayPane.h"
#include "ErrorLogDlg.h"

CLogoDisplayPane::CLogoDisplayPane()
{
}

CLogoDisplayPane::~CLogoDisplayPane()
{
}

HWND CLogoDisplayPane::CreatePaneWindow(HWND hParent, RECT& rc, DWORD dwStyle, DWORD dwExStyle)
{
    assert (hParent);
    m_hParent = hParent;
    
    dwStyle |= WS_CHILD | WS_VISIBLE;
    SetParameters(NorthSouth, &m_container, &m_info, (rc.bottom-rc.top)*2/3);
    CreateSplitterWnd(hParent, rc);

    if (!m_hWnd) {
        DWORD err = GetLastError();
        return NULL;
    }
    ::ShowWindow(m_hWnd, SW_SHOW);
    ::UpdateWindow(m_hWnd);
    m_dlgError.Create(m_hWnd);
    m_container.SetErrorInfoWindow (m_dlgError.m_hWnd);
    return m_hWnd;
}

void CLogoDisplayPane::ClearAllInfo()
{
    m_info.ClearAllInfo();
    SendMessage(m_dlgError.m_hWnd, DEL_ERRORS, 0, 0);
    SendMessage(m_dlgError.m_hWnd, HIDE_DLG, 0 , 0);
}

LRESULT CLogoDisplayPane::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    WORD h = HIWORD(lParam);
    SetBarPos (h*2/3);
    return 0;
}

